package lab02.test11;

public class Rectangle implements Printx {

    //属性

    double width;
    double high;
    double perimeter;
    double area;

    //显示边长的方法

    public double Width() {
        return width;
    }

    public double High() {
        return high;
    }

    //求周长和面积的方法

    public double perimeter() {
        double perimeter = 2 * (width + high);
        return perimeter;
    }

    public double area() {
        double area = width * high;
        return area;
    }

    //调用接口的方法

    @Override
    public void printMyWay() {
        System.out.println("矩形长为：" + high + " 矩形宽为：" + width);
        System.out.println("矩形周长为：" + perimeter());
        System.out.println("矩形面积为：" + area());
    }
}
